requests的文件是透過Sphinx生成,使用reStructuredText,副檔名為.rst
從docs/index.rst觀察可分成User Guide
, Community Guide
, API Documentation / Guide
和Contributor Guide
寫在Docstring內的描述可以轉變成文件
def post(url, data=None, json=None, **kwargs):
r"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('post', url, data=data, json=json, **kwargs)
可以對照 https://2.python-requests.org/en/master/api/#requests.post